###This is the pepline of HTTMM. (we give an example of the application of HTTMM to Acid Mine Drainage data, so the files generated contained have prefix od postfix 'AMD'. Users can change freely according to their willings) 
step 1. Run python file 'runBLAST.py'.
   Preparations should be done before running BLAST. The query sequences should be stored as '.fna' files, with file names saved in 'query_filename.txt'(e.g. example.txt). The reference database should be stored in the path of BLAST.
   This step will BLAST quey sequences to reference genomes and extract the alignments with >=70 identity rate. The BLAST parameters can be further adjusted freely.
   This step will output several files. 
   The aligned reads are stored in list rd, as 'XXX_read_f_2.txt',
   The genome ID identified by BLAST are saved in list gi, as 'XXX_gi_f_2.txt'
   In 'XXX_blre_f_2.txt', the 3 columns are the index of read in list rd, the index of gi in list gi and the qscore. 
   
step 2. start MATLAB and run "genomeID2taxonomicIDmapping.m".
  !!!WARNING this step needs to download file gi_taxid_nucl.dmp(http://www.google.com.hk/webhp?hl=zh-CN&sourceid=cnhp#hl=zh-CN&newwindow=1&q=gi_taxid_nucl.dmp&safe=strict),which is essential for transforming genome id into NCBI taxonomy id mapping.
  Input of this M function is 'XXX_read_f_2.txt' generated by step 1.
  The genome ID and the corresponding taxonomic ID are stored in gi_ti_map.txt

step 3. Run python file 'seqread2taxonomicscore.py'.
   In this step, the taxonomic ID identified in metagenomic sample are saved in list taxa, as 'XXX_taxa_f_3.txt'
  'XXX_blre_f_3.txt' is outputed, 3 columns represent the index of reads in list rd, the index of taxa in 'XXX_taxa_f_3.txt' and qscore. 

step 4. start MATLAB and run 'taxonomicgroupcoverage.m'.
   The function first outputs 'XXX_blre_f_b_3.txt'. column 1 is read id and the following are the taxa id the read could mapping to.
   the taxonomy structure is stored in BAtaxtree_1.MAT. the M function will generate several files represent the coverage structure of the taxonomy tree, which are used in HTTMM calculation. In each line, the first node is father node and following are their successors in the taxonomy tree.
   Because the intermediate nodes can be added to the model gradually from low (species) to high (phylum), files 'XXX_cm_1(or 2,3,4,5,nr).txt' are generated.
   1(or 2,3,4,5,nr) represent the coverage structure of taxonomy tree down or at species, genus, family, phylum, all nodes (=tree) and leaf level respectively.
   
step 5. Run python file 'conditionalProbability.py'
   This function will generate 'XXX_PM_1(or 2,3,4,5,nr).txt'. Colums represent read id, taxa id and the conditional probability P(d|z) as defined in equation (2).
   
step 6. Start MATLAB and run 'runEM.m'.
   This is the E-M step of HTTMM and will output taxonomy estimation of HTTMM model at different taxonomy ranks, from species to phylum, tree level and leaf level, as specified in step 4.